package com.yuwj.chinaa.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yuwj.chinaa.R;
import com.yuwj.chinaa.entity.EntityComputeCode;

import java.util.List;

/**
 * homeFragment里面的机器adapter
 */
public class MyComputeCodeAdapter extends BaseQuickAdapter<EntityComputeCode, BaseViewHolder> {
    Context context;

    public MyComputeCodeAdapter(Context context, List<EntityComputeCode> datas) {
        super(R.layout.item_compute_code, datas);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, final EntityComputeCode item) {
        holder.setText(R.id.tv_name, item.getName() + "");
        holder.setText(R.id.tv_miner_no, item.getMinerNo() + "");
        holder.setText(R.id.tv_unit_efficiency, item.getUnitEfficiency() + "");
        holder.setText(R.id.tv_remain_efficiency, item.getRemainEfficiency() + "");
        holder.setText(R.id.tv_status, item.getStatus() + "");

        if (item.isNeedDeposit()) {
            holder.setText(R.id.tv_deposit, "算码押金");
        } else {
            holder.setText(R.id.tv_deposit, "退还押金");
        }
        holder.addOnClickListener(R.id.tv_deposit);
    }

}
